<script setup lang="ts">
import { addModalPicker, BaseType, Data, ModalPickerProps, openModalPicker, PageOut, sleep } from '@idmy/core'

const page = (): PageOut<Data> => {
	return {
		total: 4327,
		// @ts-ignore
		list: [
			{
				artId: 1006,
				artCode: 'XYF1960',
				artName: '本维莫德乳膏',
				artSpec: '10g：0.1g（1%）',
				packUnit: '支',
				producer: '广东中昊药业',
				cellUnit: '支',
				packCells: 1,
				doseUnit: 'g',
				cellDoses: 10.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'BWMDRG',
				qsCode2: 'BENWEIMODERUGAO',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20190026',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XD05AXB232F002010180536',
				medId: 1006,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '本维莫德乳膏',
				medCellUnit: '支',
				medDoseUnit: 'g',
				feeTypeName: '西药费',
			},
			{
				artId: 1007,
				artCode: '01001321',
				artName: '奥司他韦',
				artSpec: '75mg*10S',
				packUnit: '盒',
				producer: '宜昌东阳光长江',
				cellUnit: '粒',
				packCells: 10,
				doseUnit: 'mg',
				cellDoses: 75.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'ASTW',
				qsCode2: 'AOSITAWEI',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20065415',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XJ05AHA218E001010301997',
				ypidCode: '86901997000151',
				medId: 1007,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '奥司他韦',
				medCellUnit: '粒',
				medDoseUnit: 'mg',
				feeTypeName: '西药费',
			},
			{
				artId: 1008,
				artCode: '01000024',
				artName: '蛋白琥珀酸铁',
				artSpec: '15ml*10瓶',
				packUnit: '盒',
				producer: 'ITALFARMACO S.A.',
				artClassId: 18,
				cellUnit: '瓶',
				packCells: 10,
				doseUnit: 'ml',
				cellDoses: 15.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'DBHPST',
				qsCode2: 'DANBAIHUPOSUANTIE',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20160143',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XB03ABD038X001010278532',
				ypidCode: '86978532000020',
				medId: 1008,
				disabled: 0,
				artClassName: '西药',
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '蛋白琥珀酸铁',
				medCellUnit: '瓶',
				medDoseUnit: 'ml',
				feeTypeName: '西药费',
			},
			{
				artId: 1009,
				artCode: '01001982',
				artName: '地屈孕酮',
				artSpec: '10mg*20片',
				packUnit: '盒',
				producer: 'Abbott Biologicals B.V.',
				artClassId: 18,
				cellUnit: '片',
				packCells: 20,
				doseUnit: 'mg',
				cellDoses: 10.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'DQYT',
				qsCode2: 'DIQUYUNTONG',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20170221',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XG03DBD084A001010178890',
				ypidCode: '86978890000373 ',
				medId: 1009,
				disabled: 0,
				artClassName: '西药',
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '地屈孕酮',
				medCellUnit: '片',
				medDoseUnit: 'mg',
				feeTypeName: '西药费',
			},
			{
				artId: 1010,
				artCode: '20002982',
				artName: '屈螺酮炔雌醇',
				artSpec: '0.03mg：3mg*21片',
				packUnit: '盒',
				producer: '拜耳医药',
				artClassId: 18,
				cellUnit: '片',
				packCells: 21,
				doseUnit: 'mg',
				cellDoses: 0.03,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'QLTGCC',
				qsCode2: 'QULUOTONGGUICICHUN',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'J20171071',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XG03AAQ115A001010107785',
				ypidCode: '86907785000082',
				medId: 1010,
				disabled: 0,
				artClassName: '西药',
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '屈螺酮炔雌醇',
				medCellUnit: '片',
				medDoseUnit: 'mg',
				feeTypeName: '西药费',
			},
			{
				artId: 1011,
				artCode: 'ZCY2314',
				artName: '复方乌鳢口服液',
				artSpec: '10ml×6支',
				packUnit: '盒',
				producer: '湖南明瑞制药',
				cellUnit: '支',
				packCells: 6,
				doseUnit: 'ml',
				cellDoses: 10.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'FFWLKFY',
				qsCode2: 'FUFANGWULIKOUFUYE',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'B20020365',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'ZZ01AAF0652010105001',
				ypidCode: '86905001000052',
				medId: 1011,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '复方乌鳢口服液',
				medCellUnit: '支',
				medDoseUnit: 'ml',
				feeTypeName: '西药费',
			},
			{
				artId: 1012,
				artCode: '02001601',
				artName: '黄柏八味片',
				artSpec: '0.5g*30片*3瓶',
				packUnit: '盒',
				producer: '湖南兴蒙制药有限公司',
				cellUnit: '瓶',
				packCells: 3,
				doseUnit: '片',
				cellDoses: 30.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'HBBWP',
				qsCode2: 'HUANGBOBAWEIPIAN',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'Z20123010',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'ZI02AAH0275010209605',
				ypidCode: '86909605000012',
				medId: 1012,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '黄柏八味片',
				medCellUnit: '片',
				medDoseUnit: 'g',
				feeTypeName: '西药费',
			},
			{
				artId: 1013,
				artCode: '01001027',
				artName: '雌二醇/雌二醇地屈孕酮',
				artSpec: '2mg：10mg*28s',
				packUnit: '盒',
				producer: 'Abbott Biologicals B.V.',
				cellUnit: '片',
				packCells: 28,
				doseUnit: 'mg',
				cellDoses: 2.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'CEC/CECDQYT',
				qsCode2: 'CIERCHUN/CIERCHUNDIQ',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20150345',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XG03FBC051A001020178890',
				ypidCode: '86978890000304',
				medId: 1013,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '雌二醇/雌二醇地屈孕酮',
				medCellUnit: '片',
				medDoseUnit: 'mg',
				feeTypeName: '西药费',
			},
			{
				artId: 1014,
				artCode: '01000869',
				artName: '雌二醇/雌二醇地屈孕酮',
				artSpec: '1mg：10mg*28s',
				packUnit: '盒',
				producer: 'Abbott Biologicals B.V.',
				cellUnit: '片',
				packCells: 28,
				doseUnit: 'mg',
				cellDoses: 1.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'CEC/CECDQYT',
				qsCode2: 'CIERCHUN/CIERCHUNDIQ',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20150346',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XG03FBC051A001010178890',
				ypidCode: '86978890000281',
				medId: 1014,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '雌二醇/雌二醇地屈孕酮',
				medCellUnit: '片',
				medDoseUnit: 'mg',
				feeTypeName: '西药费',
			},
			{
				artId: 1015,
				artCode: 'XYF2409',
				artName: '他克莫司软膏',
				artSpec: '10g：3mg(0.03%)',
				packUnit: '支',
				producer: '浙江万晟药业',
				cellUnit: '支',
				packCells: 1,
				doseUnit: 'g',
				cellDoses: 10.0,
				lastUpdated: '2022-10-18 12:13:55',
				qsCode1: 'TKMSRG',
				qsCode2: 'TAKEMOSIRUANGAO',
				feeTypeId: 9,
				stockReq: 1,
				approvalNo: 'H20133243',
				artTypeId: 11,
				catTypeId: 101,
				forOe: 1,
				miCode: 'XD11AXT002F001010180999',
				ypidCode: '86904726000699',
				medId: 1015,
				disabled: 0,
				artTypeName: '西药',
				catTypeName: '西药',
				chnName: '他克莫司软膏',
				medCellUnit: '支',
				medDoseUnit: 'g',
				feeTypeName: '西药费',
			},
		],
	}
}

addModalPicker('a', (params: Data, selectedKeys: BaseType[]): ModalPickerProps => {
	return {
		rowKey: 'artId',
		title: '项目选择',
		multiple: true,
		width: 4,
		showSelected: false,
		selectedKeys,
		columns: [
			{ title: '项目代号', dataIndex: 'artId', align: 'center', width: 100, selected: true },
			{ title: '申请单类型', dataIndex: 'artName', align: 'center', width: 100, selected: true },
			{ title: '项目编码', dataIndex: 'artCode', align: 'center', width: 220 },
			{ title: '项目名称', dataIndex: 'artName', align: 'center', width: 120 },
			{ title: '项目名称', dataIndex: 'artName', align: 'center', width: 120 },
			{ title: '项目名称', dataIndex: 'artName', align: 'center', width: 120 },
			{ title: '项目名称', dataIndex: 'artName', align: 'center', width: 120 },
			{ title: '项目名称', dataIndex: 'artName', align: 'center', width: 120 },
			{ title: '项目名称', dataIndex: 'artName', align: 'center', width: 120 },
			{ title: '项目分类', dataIndex: 'catTypeName', align: 'center', width: 120 },
		],
		api: async (args: any) => {
			console.info(args)
			await sleep(100)
			return await page()
		},
		conds: [{ title: '关键字', field: 'keyword' }],
	}
})

const open = async () => {
	const [rows, keys] = await openModalPicker('a', { keyword: 'aaa' }, [])
	console.info(rows, keys)
}
</script>

<template>
	<a-space>
		<a-button type="primary" @click="open">选择</a-button>
	</a-space>
</template>

<style scoped></style>
